from selenium import webdriver
import time
from pprint import pprint


driver =webdriver.Chrome()
driver.get("https://www.baidu.com")


#获取所有cookie
# pprint(driver.get_cookies())
# 获取指定cookie
# pprint(driver.get_cookie('BD_UPN'))

# 添加cookie
dict={'name':'mmmsad','value':'124124'}
dict2={'name':'lalalla','value':'124125656'}
driver.add_cookie(dict)
driver.add_cookie(dict2)
pprint(driver.get_cookies())

# 删除cookie
# driver.delete_cookie('handsome')
# pprint(driver.get_cookie('handsome'))

#删除所有cookie
driver.delete_all_cookies()
pprint(driver.get_cookies())


time.sleep(2)
driver.quit()
